import akka.actor.ActorRef;
import akka.actor.Cancellable;
import akka.actor.Props;
import jobs.MyActor;
import play.Application;
import play.GlobalSettings;
import play.Logger;
import play.libs.Akka;
import scala.concurrent.ExecutionContext;
import scala.concurrent.duration.Duration;

import java.util.concurrent.TimeUnit;




public class Global extends GlobalSettings {

    @Override
    public void onStart(Application app) {
        ActorRef testActor = Akka.system().actorOf(Props.create(MyActor.class));
        System.out.println("DEM3");
        Akka.system().scheduler().schedule(
                Duration.create(0, TimeUnit.MILLISECONDS), //Initial delay 0 milliseconds
                Duration.create(5, TimeUnit.SECONDS),     //Frequency 30 minutes
                testActor,
                "tick",
                (ExecutionContext)Akka.system().dispatcher(),
                null
        );




    }
}
